package wiBase.baseUtil;

import wiBase.WiObject;
import wiBase.baseObject.Node;

public class Position extends WiObject {

    private Node parent;
    private double _X = 0;
    private double _Y = 0;

    public Position(double d, double e) {
	this(null, d, e);
    }

    public Position(Node parent, double d, double e) {
	this.parent = parent;
	this._X = d;
	this._Y = e;
    }

    public double getX() {
	if (parent != null) {
	    return parent.x;
	} else {
	    return _X;
	}
    }

    public void setX(double X) {
	this._X = X;
	if (parent != null) {
	    parent.x = X;
	}
    }

    public double getY() {
	if (parent != null) {
	    return parent.y;
	} else {
	    return _Y;
	}
    }

    public void setY(double Y) {
	this._Y = Y;
	if (parent != null) {
	    parent.y = Y;
	}
    }

    @Override
    public String toString() {
	return "Position [_X=" + _X + ", _Y=" + _Y + "]";
    }
}
